# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1046.1.340 -> 1.1046.1.341 # kernel/module.c 1.88 -> 1.89 # include/linux/module.h 1.66 -> 1.67 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/07/15 nathans@sgi.com 1.1046.511.21 # [XFS] Max file size tweak for LBD - if LBD enabled on 32 bit platforms slightly bigger files are possible # # SGI Modid: 2.5.x-xfs:slinx:153108a # -------------------------------------------- # 03/07/15 davej@codemonkey.org.uk 1.1046.518.16 # [CPUFREQ] Fix detection of Transmeta CPUs. Makes longrun work again. # -------------------------------------------- # 03/07/15 davej@codemonkey.org.uk 1.1046.518.17 # [CPUFREQ] Fix compiler warnings in msr macros. # -------------------------------------------- # 03/07/15 jgrimm@touki.austin.ibm.com 1.1046.512.3 # [SCTP] Support v4-mapped-v6 addresses (Ardelle Fan) # -------------------------------------------- # 03/07/15 davej@codemonkey.org.uk 1.1046.518.18 # [CPUFREQ] Use standard types in wrmsrl # # -------------------------------------------- # 03/07/15 greg@kroah.com 1.1046.513.4 # [PATCH] USB: remove some warnings when building the documentation. # -------------------------------------------- # 03/07/15 greg@kroah.com 1.1046.513.5 # [PATCH] USB: flush all in-flight urbs _before_ disconnect() is called. # # This solves the module unload problem for some usb-serial drivers # (like visor.c and ftdi_sio.c), and makes usb drivers much simpler. # -------------------------------------------- # 03/07/15 greg@kroah.com 1.1046.513.6 # [PATCH] USB: fix up bluetty driver's tty and devfs names. # -------------------------------------------- # 03/07/15 greg@kroah.com 1.1046.513.7 # [PATCH] USB: fix up cdc-acm driver's tty and devfs names. # -------------------------------------------- # 03/07/15 davidm@tiger.hpl.hp.com 1.1046.515.5 # ia64: Change per-CPU implementation so that __get_cpu_var() returns the # canonical address (l-value). To get the virtually mapped # alias (which is more efficient), use __ia64_per_cpu_var(). The # latter is safe only if the address of the l-value is never passed # to another CPU (i.e., not stored in any global place). # For extremely efficient, portable per-CPU variables, there is # now a new API local.h which was introduced by Rusty Russell. # To use this, declare a variable of type local_t as a per-CPU # variable and then use {__,}cpu_local_FOO() to manipulate such # variables. This patch also updated the atomic interface with # a 64-bit counter. # -------------------------------------------- # 03/07/15 rusty@rustcorp.com.au 1.1046.1.341 # [PATCH] Use local_t for module reference counts # # -------------------------------------------- # diff -Nru a/include/linux/module.h b/include/linux/module.h --- a/include/linux/module.h Mon Sep 22 13:04:37 2003 +++ b/include/linux/module.h Mon Sep 22 13:04:37 2003 @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -171,7 +172,7 @@ struct module_ref { - atomic_t count; + local_t count; } ____cacheline_aligned; enum module_state @@ -282,12 +283,6 @@ void __symbol_put(const char *symbol); #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) void symbol_put_addr(void *addr); - -/* We only need protection against local interrupts. */ -#ifndef __HAVE_ARCH_LOCAL_INC -#define local_inc(x) atomic_inc(x) -#define local_dec(x) atomic_dec(x) -#endif /* Sometimes we know we already have a refcount, and it's easier not to handle the error case (which only happens with rmmod --wait). */ diff -Nru a/kernel/module.c b/kernel/module.c --- a/kernel/module.c Mon Sep 22 13:04:37 2003 +++ b/kernel/module.c Mon Sep 22 13:04:37 2003 @@ -374,9 +374,9 @@ INIT_LIST_HEAD(&mod->modules_which_use_me); for (i = 0; i < NR_CPUS; i++) - atomic_set(&mod->ref[i].count, 0); + local_set(&mod->ref[i].count, 0); /* Hold reference count during initialization. */ - atomic_set(&mod->ref[smp_processor_id()].count, 1); + local_set(&mod->ref[smp_processor_id()].count, 1); /* Backwards compatibility macros put refcount during init. */ mod->waiter = current; } @@ -599,7 +599,7 @@ unsigned int i, total = 0; for (i = 0; i < NR_CPUS; i++) - total += atomic_read(&mod->ref[i].count); + total += local_read(&mod->ref[i].count); return total; } EXPORT_SYMBOL(module_refcount);